package com.hmall.order.config;

import com.hmall.order.handler.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器
 *
 * @author zhang
 * @date 2022/06/13
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    @SuppressWarnings("all")
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截所有请求接口
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**");
    }
}
